<%@ page contentType="text/html;charset=utf-8" pageEncoding="UTF-8"%>
<%@include file="/common/common.jsp" %>

<html>
	<head>
		<title>组织管理_浏览组织</title>
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/skin.css">
		<link href="${pageContext.request.contextPath}/css/jquery.alerts.css" rel="stylesheet" type="text/css" media="screen">		
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery/jquery-1.4.2.min.js"></script>
		<script src="${pageContext.request.contextPath}/js/jquery/jquery.ui.draggable.js" type="text/javascript"></script>
		<script src="${pageContext.request.contextPath}/js/jquery/jquery.alerts.js" type="text/javascript"></script>
		<script src="${pageContext.request.contextPath}/js/tools.js" type="text/javascript"></script>
		<style type="text/css">
			<!--
			body {
				margin-left: 0px;
				margin-top: 0px;
				margin-right: 0px;
				margin-bottom: 0px;
			}
			.STYLE1 {font-size: 12px}
			.STYLE3 {font-size: 12px; font-weight: bold; }
			.STYLE4 {
				color: #03515d;
				font-size: 12px;
			}
			-->
		</style>
		<script type="text/javascript">

			function onUpdate(){
				if(validInfo()){
					//提交
					var url = "updateGroupInfo.action";
					var params = {
							SERIALID:$('#viewGroupId').val(),
							GROUP_NAME:$('#GROUP_NAME').attr('value'),
							GROUP_ADDR:$('#GROUP_ADDR').attr('value'),
							GROUP_ZIP:$('#GROUP_ZIP').attr('value'),
							GROUP_TEL_CN:$('#GROUP_TEL_CN').attr('value'),
							GROUP_TEL_AREA:$('#GROUP_TEL_AREA').attr('value'),
							GROUP_TEL:$('#GROUP_TEL').attr('value'),
							GROUP_FAX_CN:$('#GROUP_FAX_CN').attr('value'),
							GROUP_FAX_AREA:$('#GROUP_FAX_AREA').attr('value'),
							GROUP_FAX:$('#GROUP_FAX').attr('value'),
							GROUP_DESC:$('#GROUP_DESC').attr('value'),
							GROUP_REMARK:$('#GROUP_REMARK').attr('value')						
							};
					$.post(url, params, callback, "json");
				}
			}

			function callback(data){			
				if(data.results == "success"){
					onReset();
					groupForm.GROUP_CODE.value = "";
					//jAlert('success', '修改组织成功!', '操作提示');
					jConfirm('修改成功！', '操作提示', function(r) {
						reDirect();//location.href='admin/group/groupList.action'		
			            });
				}else{
					if(data.results == "groupnamedup"){
						jAlert('error', '组织名称已存在', '操作提示');		
					}else{
						jAlert('error', data, '操作提示');		
					}
				}			
			}			

			function onReset(){
				groupForm.GROUP_NAME.value = "";
				groupForm.GROUP_ADDR.value = "";
				groupForm.GROUP_ZIP.value = "";
				groupForm.GROUP_TEL_CN.value = "";
				groupForm.GROUP_TEL_AREA.value = "";
				groupForm.GROUP_TEL.value = "";
				groupForm.GROUP_FAX_CN.value = "";
				groupForm.GROUP_FAX_AREA.value = "";
				groupForm.GROUP_FAX.value = "";
				groupForm.GROUP_DESC.value = "";
				groupForm.GROUP_REMARK.value = "";
			}

		  	function validInfo(){
				var grpform = document.groupForm;
				if(grpform.GROUP_CODE.value.trim() == ""){
					jAlert('error', '组织编号不能为空!', '错误提示');					
					grpform.GROUP_CODE.focus();
					return false;
				}
				if(grpform.GROUP_NAME.value.trim() == ""){
					jAlert('error', '组织名称不能为空!', '错误提示');
					grpform.GROUP_NAME.focus();
					return false;
				}
			  	return true;
		  	}

		  	//返回列表页面
		  	function reDirect(){
		  		window.location.href='admin/group/groupList.action'; 
		  	}
		</script>
	</head>
	
	<body>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td height="30" background="${pageContext.request.contextPath}/admin/images/main/tab_05.gif">
					<!-- 导航条 -->
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
			      		<tr>
			        		<td width="12" height="30"><img src="${pageContext.request.contextPath}/admin/images/main/left-top-right.gif" width="12" height="30" /></td>
			       			<td>
			       				<table width="100%" border="0" cellspacing="0" cellpadding="0">
			          				<tr>
			            				<td width="46%" valign="middle">
			            					<table width="100%" border="0" cellspacing="0" cellpadding="0">
			              						<tr>
			                						<td width="5%"><div align="center"><img src="${pageContext.request.contextPath}/admin/images/main/tb.gif" width="16" height="16" /></div></td>
			                						<td width="95%" class="STYLE1"><span class="STYLE3">你当前的位置</span>：[组织管理]-[组织列表]-[浏览组织]</td>
			              						</tr>
			            					</table>
			            				</td>			            				
			          				</tr>
			        			</table>
			        		</td>
			        		<td width="16"><img src="${pageContext.request.contextPath}/admin/images/main/nav-right-bg.gif" width="16" height="30" /></td>
			      		</tr>
			    	</table>
			    </td>
			</tr>
			<!-- 新增内容 -->
			<tr>
				<td>
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
			    		<tr>
					  	 	<td>
						  	 	<table width="100%" height="30" border="0" bgcolor="b5d6e6" cellpadding="0" cellspacing="1" class="nowtable">
						         	<tr>
						           		<td class="left_bt2">&nbsp;&nbsp;&nbsp;&nbsp;组织基本信息设置</td>
						         	</tr>
					       		</table>
				       	 	</td>
			       	 	</tr>
					</table>
				</td>
			</tr>
			<!-- 表单提交 -->
			<s:form name="groupForm" id="groupForm" action="updateGroupinfo" method="post" namespace="/group" >
				<tr>
					<td>
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr >
								<td width="20%" height="30" align="right" bgcolor="#f2f2f2" class="left_txt2">组织编号：</td>
								<td width="25%" height="30" bgcolor="#f2f2f2"><input name="GROUP_CODE" id="GROUP_CODE" type="text" size="40" readonly="readonly" value="<s:property value="GROUP_CODE"/>"/></td>
								<td width="10%" height="30" align="left" bgcolor="#f2f2f2" ><font color="red">（必填项）</font></td>
								<td width="10%" height="30" align="right" bgcolor="#f2f2f2" class="left_txt2">组织名称：</td>
								<td width="25%" height="30" bgcolor="#f2f2f2"><input name="GROUP_NAME" id="GROUP_NAME" type="text" size="40" value="<s:property value="GROUP_NAME"/>"/></td>
								<td width="10%" height="30" align="left" bgcolor="#f2f2f2" ><font color="red">（必填项）</font></td>
							</tr>
							<tr >
								<td width="20%" height="30" align="right" class="left_txt2">通信地址：</td>
								<td width="25%" height="30" colspan="2"><input name="GROUP_ADDR" id="GROUP_ADDR" type="text" size="60" value="<s:property value="GROUP_ADDR"/>"/></td>
								
								<td width="10%" height="30" align="right" class="left_txt2">邮政编码：</td>
								<td width="25%" height="30" >
								<input name="GROUP_ZIP" id="GROUP_ZIP" type="text" size="40" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" value="<s:property value="GROUP_ZIP"/>" /></td>
								<td width="10%" height="30" align="left" >&nbsp;</td>
							</tr>
							<tr >
								<td width="20%" height="30" align="right" bgcolor="#f2f2f2" class="left_txt2">办公电话：</td>
								<td width="35%" height="30" bgcolor="#f2f2f2" colspan="2">
									<input name="GROUP_TEL_CN" id="GROUP_TEL_CN" type="text" size="3" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" value="<s:property value="GROUP_TEL_CN"/>"/>
									-<input name="GROUP_TEL_AREA" id="GROUP_TEL_AREA" type="text" size="5" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" value="<s:property value="GROUP_TEL_AREA"/>" />
									-<input name="GROUP_TEL" id="GROUP_TEL" type="text" size="20" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" value="<s:property value="GROUP_TEL"/>"/>
								</td>

								<td width="15%" height="30" align="right" bgcolor="#f2f2f2" class="left_txt2">办公传真：</td>
								<td width="30%" height="30" bgcolor="#f2f2f2" colspan="2">
									<input name="GROUP_FAX_CN" id="GROUP_FAX_CN" type="text" size="3" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" value="<s:property value="GROUP_FAX_CN"/>"/>
									-<input name="GROUP_FAX_AREA" id="GROUP_FAX_AREA" type="text" size="5" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" value="<s:property value="GROUP_FAX_AREA"/>"/>
									-<input name="GROUP_FAX" id="GROUP_FAX" type="text" size="20" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" value="<s:property value="GROUP_FAX"/>"/>
								</td>
							</tr>
							<tr >
								<td width="20%" height="30" align="right" class="left_txt2">组织描述：</td>
								<td width="80%" height="30" colspan="5"><input name="GROUP_DESC" id="GROUP_DESC" type="text" size="150" value="<s:property value="GROUP_DESC"/>"/></td>
							</tr>
							<tr >
								<td width="20%" height="30" align="right" class="left_txt2">备注：</td>
								<td width="80%" height="30" colspan="5"><input name="GROUP_REMARK" id="GROUP_REMARK" type="text" size="150" value="<s:property value="REMARK"/>"/></td>
							</tr>
						</table>
					</td>
			  	</tr>
			  <tr>
              	  <td height="30">&nbsp;</td>
              </tr>
              <tr>
                  <td align="center">
              		  <table>
              			 <tr>
              				<td width="30%"><input type=button value="&nbsp;保&nbsp;存&nbsp;" name="B1" onclick="onUpdate()" /></td>
              				<td width="5%" height="30" align="right">&nbsp;</td>
              				<td width="30%"><input type="reset" value="&nbsp;清&nbsp;空&nbsp;" name="B12" /></td>
              				<td width="5%" height="30" align="right">&nbsp;</td>
              				<td width="30%"><input type=button value="&nbsp;返&nbsp;回&nbsp;" name="B2" onclick="reDirect()"/></td>
              			 </tr>
            		 </table>
            	 </td>	 
     	      </tr> 
     	      <input type="hidden" name="viewGroupId" id="viewGroupId" value="<s:property value="viewGroupId"/>"/>
			</s:form>
			
		</table>
	</body>
</html>